import { createStore } from 'vuex'
import pre from 'vuex-persistedstate'
export default createStore({
  state: {
    list:[]
  },
  getters: {
  },
  mutations: {
    add(state,obj){
        state.list.push({
           time:new Date().getTime(),
           ...obj
        })
    },
    // 编辑
    edit(state,obj){
        let {index,form} = obj
        state.list[index] = form

    },
    del(state,index){
        state.list.splice(index,1)
    }
  },
  actions: {
  },
  modules: {
  },
  plugins:[pre()]
})
